/**
 */
package moore.impl;

import moore.AbstractState;
import moore.MoorePackage;

import org.eclipse.emf.common.notify.Notification;

import org.eclipse.emf.ecore.EClass;
import org.eclipse.emf.ecore.InternalEObject;

import org.eclipse.emf.ecore.impl.ENotificationImpl;

/**
 * <!-- begin-user-doc -->
 * An implementation of the model object '<em><b>Abstract State</b></em>'.
 * <!-- end-user-doc -->
 * <p>
 * The following features are implemented:
 * <ul>
 *   <li>{@link moore.impl.AbstractStateImpl#getOutputState <em>Output State</em>}</li>
 * </ul>
 * </p>
 *
 * @generated
 */
public abstract class AbstractStateImpl extends AbstractElementImpl implements AbstractState {
	/**
	 * The cached value of the '{@link #getOutputState() <em>Output State</em>}' reference.
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @see #getOutputState()
	 * @generated
	 * @ordered
	 */
	protected AbstractState outputState;

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	protected AbstractStateImpl() {
		super();
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	@Override
	protected EClass eStaticClass() {
		return MoorePackage.Literals.ABSTRACT_STATE;
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public AbstractState getOutputState() {
		if (outputState != null && outputState.eIsProxy()) {
			InternalEObject oldOutputState = (InternalEObject)outputState;
			outputState = (AbstractState)eResolveProxy(oldOutputState);
			if (outputState != oldOutputState) {
				if (eNotificationRequired())
					eNotify(new ENotificationImpl(this, Notification.RESOLVE, MoorePackage.ABSTRACT_STATE__OUTPUT_STATE, oldOutputState, outputState));
			}
		}
		return outputState;
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public AbstractState basicGetOutputState() {
		return outputState;
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public void setOutputState(AbstractState newOutputState) {
		AbstractState oldOutputState = outputState;
		outputState = newOutputState;
		if (eNotificationRequired())
			eNotify(new ENotificationImpl(this, Notification.SET, MoorePackage.ABSTRACT_STATE__OUTPUT_STATE, oldOutputState, outputState));
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	@Override
	public Object eGet(int featureID, boolean resolve, boolean coreType) {
		switch (featureID) {
			case MoorePackage.ABSTRACT_STATE__OUTPUT_STATE:
				if (resolve) return getOutputState();
				return basicGetOutputState();
		}
		return super.eGet(featureID, resolve, coreType);
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	@Override
	public void eSet(int featureID, Object newValue) {
		switch (featureID) {
			case MoorePackage.ABSTRACT_STATE__OUTPUT_STATE:
				setOutputState((AbstractState)newValue);
				return;
		}
		super.eSet(featureID, newValue);
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	@Override
	public void eUnset(int featureID) {
		switch (featureID) {
			case MoorePackage.ABSTRACT_STATE__OUTPUT_STATE:
				setOutputState((AbstractState)null);
				return;
		}
		super.eUnset(featureID);
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	@Override
	public boolean eIsSet(int featureID) {
		switch (featureID) {
			case MoorePackage.ABSTRACT_STATE__OUTPUT_STATE:
				return outputState != null;
		}
		return super.eIsSet(featureID);
	}

} //AbstractStateImpl
